<template>
    <div class="page rollOut">
        <header-view title="转入"></header-view>
        <div class="rollOutCot">
            <div class="flex-container rollBank">
                <div class="left"><span class="bankIcon" :style="{backgroundImage: 'url(' + getBankIcon + ')'}"></span></div>
                <div class="center">
                    <h3>{{bankData.bankName}}</h3>
                    <p>{{Account.TAcNo}}</p>
                </div>
                <div class="right">
                    <span></span>
                </div>
            </div>
            <div class="rollTitle">
                <h4>转出金额（元）</h4>
                <input type="number" v-model="Amount" placeholder="0.00"/>
            </div>
        </div>
        <button-view title="确认转入" @btnFnBack="bankToAccount"></button-view>
        <!--支付弹框-->
        <div class="comPayBox" v-show="showPwdModal">
            <a class="comPayCancel" @click="showPwdModal=!showPwdModal">取消</a>
            <div class="comSIPBWrap">
                <input type="text" id="SIPBox" name="SIPBox" readonly class="comSIPBox"/>
                <ul class="clearfix"><li></li><li></li><li></li><li></li><li></li><li></li></ul>
            </div>
            <div id="NumberKeyboard"></div>
        </div>
    </div>
</template>

<script>
    import HeaderView from './../components/header';
    import ButtonView from './../components/button';
    import bankInfor from './../js/bank';
    import utils from './../js/utils';
    export default {
        name: 'shiftTo',
        data(){
            return {
                bankData: {},
                Account: {},
                Amount: '',
                showPwdModal: false
            }
        },
        components:{
            HeaderView,
            ButtonView
        },
        computed:{
            getBankIcon(){
                return 'https://apimg.alipay.com/combo.png?d=cashier&t=' + this.bankData.bankCode;
            }
        },
        mounted() {
            let Account = utils.getSessionStorage('Account');
            this.Account = Account;
            this.bankData = bankInfor(Account.TAcNo);
        },
        methods:{
            bankToAccount(){
                if(!this.Amount){
                    utils.showTips('请输入转出的金额!');
                    return;
                }
                let that = this;
                utils.getPwdModal(this, function(val , randomData , keyboard ){
                    utils.ajax({
                        url: utils.AJAX_SRC + 'Minsheng/bankToAccount',
                        params:{
                            Amount: that.Amount,
                            PwdResult: val,
                            RandJnlNo: randomData.RandJnlNo,
                            Random: randomData.Random
                        },
                        success(result){
                            if(result.errcode < 0){
                                utils.showTips(result.errmsg);
                                return;
                            }
                            utils.showTips('转入成功!');
                            that.$router.back();
                        }
                    });
                });
            }
        }
    }
</script>
